<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>COMMODITYVARIETY</title>
    <style>
  .ui-button {
  	  display: inline-block;
	  padding: 2px 2px;
	  margin-bottom: 0;
	  font-size: 8px;
	  font-weight: normal;
	  line-height: 1.42857143;
	  text-align: center;
	  white-space: nowrap;
	  vertical-align: middle;
	  -ms-touch-action: manipulation;
      touch-action: manipulation;
	  cursor: pointer;
	  -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
	  background-image: none;
	  border: 1px solid transparent;
	  border-radius: 4px;
  }
  </style>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript">
  $(document).ready(function(){
	$('#tt').tabs({
	   onSelect:function(title){
	       $('#tt .panel-body').css('width','auto');
		}
	});
	$(".tabs-wrap").css('width','60%');
  });
 </script>
 </head>
 <body style="overflow-x: hidden;">
  <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="6" action="commodityvarietyController.do?doAdd">
					<input id="id" name="id" type="hidden" value="${commodityvarietyPage.id }"/>
	<table style="width: 60%;" cellpadding="0" cellspacing="1" class="formtable">
		<tr>
			<td align="right">
				<label class="Validform_label">类别编码:</label>
			</td>
			<td class="value">
		     	 <input id="varietycode" name="varietycode" type="text" maxlength="20" style="width: 150px"  datatype="*"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">类别编码</label>
			</td>
			<td align="right">
				<label class="Validform_label">类别名称:</label>
			</td>
			<td class="value">
		     	 <input id="varietyname" name="varietyname" type="text" maxlength="50" style="width: 150px"  datatype="*"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">类别名称</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">类别所属板块编号:</label>
			</td>
			<td class="value">
				<input id="sectorid" name="sectorid" type="text" style="width: 150px" class="searchbox-inputtext" readonly="readonly" datatype="n"  ignore="checked"  onclick="popupClick(this,'sectorid','sectorid','sector_select')"/>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">类别所属板块编号</label>
			</td>
			<td align="right">
				<label class="Validform_label">是否标准品:</label>
			</td>
			<td class="value">
					  <t:dictSelect field="isstandard" type="list"  datatype="*"   typeGroupCode="YORN"  defaultVal="${commodityvarietyPage.isstandard}" hasLabel="false"  title="是否标准品" ></t:dictSelect>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">是否标准品</label>
			</td>
		</tr>

		<tr>

			<td align="right">
				<label class="Validform_label">计量单位:</label>
			</td>
			<td class="value">
		     	 <input id="measurementunit" name="measurementunit" type="text" maxlength="20" style="width: 150px"  datatype="*"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">计量单位</label>
			</td>
			<td align="right">
				<label class="Validform_label">计价单位:</label>
			</td>
			<td class="value">
		     	 <input id="chargeunit" name="chargeunit" type="text" maxlength="20" style="width: 150px"  datatype="*"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">计价单位</label>
			</td>
		</tr>
		<tr>

			<td align="right">
				<label class="Validform_label">价格类型定义:</label>
			</td>
			<td class="value">
		     	 <input id="pricetype" name="pricetype" type="text" maxlength="20" style="width: 150px"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">价格类型定义</label>
			</td>

			<td align="right">
				<label class="Validform_label">父级编号:</label>
			</td>
			<td class="value">
				<input id="parentid" name="parentid" type="text" style="width: 150px" class="searchbox-inputtext"  datatype="n" readonly="readonly" ignore="checked"  onclick="popupClick(this,'varietyid','parentid','commodityvariety_select')"/>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">父级编号</label>
			</td>

		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">是否有效:</label>
			</td>
			<td class="value">
					  <t:dictSelect field="isvalid" type="list"  datatype="*"   typeGroupCode="ISN"  defaultVal="${commodityvarietyPage.isvalid}" hasLabel="false"  title="是否有效" ></t:dictSelect>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">是否有效</label>
			</td>
			<td align="right">
				<label class="Validform_label">最小变动价位:</label>
			</td>
			<td class="value">
		     	 <input id="minpricemove" name="minpricemove" type="text" maxlength="10" style="width: 150px"  datatype="*"  ignore="checked" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">最小变动价位</label>
			</td>
			</tr><tr>
				<td align="right">
				<label class="Validform_label">上市状态:</label>
			</td>
			<td class="value">
					  <t:dictSelect field="status" type="list"  datatype="*"   typeGroupCode="LISTEDSTATUS"  defaultVal="${commodityvarietyPage.status}" hasLabel="false"  title="上市状态" ></t:dictSelect>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">上市状态</label>
			</td>

			<td align="right">
				<label class="Validform_label">排序号:</label>
			</td>
			<td class="value">
		     	 <input id="orderid" name="orderid" type="text" maxlength="19" style="width: 150px"  datatype="n"  ignore="checked"  value="1" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">排序号</label>
			</td>
		</tr>
		<!--
		<tr>
			<td align="right">
				<label class="Validform_label">涨跌幅算法:</label>
			</td>
			<td class="value">
					  <t:dictSelect field="spreadalgr" type="list"   typeGroupCode="RiseFallTp"  defaultVal="${commodityvarietyPage.spreadalgr}" hasLabel="false"  title="涨跌幅算法" ></t:dictSelect>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">涨跌幅算法</label>
			</td>
			<td align="right">
				<label class="Validform_label">跌幅下限:</label>
			</td>
			<td class="value">
		     	 <input id="spreaddownlmt" name="spreaddownlmt" type="text" maxlength="10" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">跌幅下限</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">涨幅上限:</label>
			</td>
			<td class="value">
		     	 <input id="spreaduplmt" name="spreaduplmt" type="text" maxlength="10" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">涨幅上限</label>
			</td>

		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">运输方式定义:</label>
			</td>
			<td class="value">
		     	 <input id="transporttype" name="transporttype" type="text" maxlength="20" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">运输方式定义</label>
			</td>
			<td align="right">
				<label class="Validform_label">交收方式定义:</label>
			</td>
			<td class="value">
		     	 <input id="delivertype" name="delivertype" type="text" maxlength="20" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">交收方式定义</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">交收地点定义:</label>
			</td>
			<td class="value">
		     	 <input id="deliverplace" name="deliverplace" type="text" maxlength="20" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">交收地点定义</label>
			</td>
			<td align="right">
				<label class="Validform_label">结算方式定义:</label>
			</td>
			<td class="value">
		     	 <input id="settletype" name="settletype" type="text" maxlength="20" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">结算方式定义</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">付款方式定义:</label>
			</td>
			<td class="value">
		     	 <input id="paymenttype" name="paymenttype" type="text" maxlength="20" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">付款方式定义</label>
			</td>
			<td align="right">
				<label class="Validform_label">品种英文名称:</label>
			</td>
			<td class="value">
		     	 <input id="varietynameEn" name="varietynameEn" type="text" maxlength="50" style="width: 150px"  ignore="ignore" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">品种英文名称</label>
			</td>
		</tr>  -->


	</table>
			<div style="width: auto;height: 200px;">
				<%-- 增加一个div，用于调节页面大小，否则默认太小 --%>
				<div style="width:800px;height:1px;"></div>
				<t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
				 <t:tab href="commodityvarietyController.do?commodityvarietyattrList&id=${commodityvarietyPage.id}" icon="icon-search" title="品种属性" id="commodityvarietyattr"></t:tab>
				</t:tabs>
			</div>
			</t:formvalid>
			<!-- 添加 附表明细 模版 -->
	<table style="display:none;">
	<tbody id="add_commodityvarietyattr_table_template">
		<tr>
			 <td align="center"><div style="width: 25px;" name="xh"></div></td>
			 <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].attrname" maxlength="30" type="text"  style="width:120px;"  datatype="*"  ignore="checked" />
					  <label class="Validform_label" style="display: none;">属性标识名称</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].attrtitle" maxlength="50" type="text"  style="width:120px;"  datatype="*"  ignore="checked" />
					  <label class="Validform_label" style="display: none;">属性显示中文名称</label>
				  </td>
				    <td align="left">
							<t:dictSelect field="commodityvarietyattrList[#index#].attrtype" type="list"   datatype="*"   typeGroupCode="COMMODITYVARIETYATTRTYPE"  defaultVal="" hasLabel="false"  title="属性类型"></t:dictSelect>
					  <label class="Validform_label" style="display: none;">属性类型</label>
				  </td>
				  <td align="left">
							<t:dictSelect field="commodityvarietyattrList[#index#].attrobjecttype" type="list"   datatype="*"   typeGroupCode="ATTOBJTYPE"  defaultVal="" hasLabel="false"  title="属性数值类型"></t:dictSelect>
					  <label class="Validform_label" style="display: none;">属性数值类型</label>
				  </td>
				  <td align="left">
							<t:dictSelect field="commodityvarietyattrList[#index#].controltype" type="list"   datatype="*"   typeGroupCode="CONTYPE"  defaultVal="" hasLabel="false"  title="控件类型"></t:dictSelect>
					  <label class="Validform_label" style="display: none;">控件类型</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].defaultvalue" maxlength="100" type="text"  style="width:120px;"  ignore="ignore" />
					  <label class="Validform_label" style="display: none;">默认值</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].refobject" maxlength="30" type="text"  style="width:120px;"  ignore="ignore" />
					  <label class="Validform_label" style="display: none;">引用对象</label>
				  </td>
				  <td align="left">
							<t:dictSelect field="commodityvarietyattrList[#index#].isvalid" type="list"   datatype="*"   typeGroupCode="ISN"  defaultVal="" hasLabel="false"  title="是否有效"></t:dictSelect>
					  <label class="Validform_label" style="display: none;">是否有效</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].orderid" maxlength="19" type="text"  style="width:120px;"  datatype="n"  ignore="ignore" />
					  <label class="Validform_label" style="display: none;">排序</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].sign" maxlength="20" type="text"  style="width:120px;"  ignore="ignore" />
					  <label class="Validform_label" style="display: none;">符号</label>
				  </td>
				  <td align="left">
					  	<input name="commodityvarietyattrList[#index#].unit" maxlength="20" type="text"  style="width:120px;"  ignore="ignore" />
					  <label class="Validform_label" style="display: none;">单位</label>
				  </td>
			</tr>
		 </tbody>
		</table>
 </body>
 <script type="text/javascript">
	 //初始化下标
	 function resetTrNum(tableId) {
		 $tbody = $("#"+tableId+"");
		 $tbody.find('>tr').each(function(i){
			 $(':input, select,button,a', this).each(function(){
				 var $this = $(this),validtype_str = $this.attr('validType'), name = $this.attr('name'),id=$this.attr('id'),onclick_str=$this.attr('onclick'), val = $this.val();
				 if(name!=null){

					 if (name.indexOf("#index#") >= 0){
						 $this.attr("name",name.replace('#index#',i));
					 }else{
						 var s = name.indexOf("[");
						 var e = name.indexOf("]");
						 var new_name = name.substring(s+1,e);
						 $this.attr("name",name.replace("["+new_name+"]","["+i+"]"));
					 }
				 }
				 if(id!=null){
					 if (id.indexOf("#index#") >= 0){
						 $this.attr("id",id.replace('#index#',i));
					 }else{
						 var s = id.indexOf("[");
						 var e = id.indexOf("]");
						 var new_id = id.substring(s+1,e);
						 $this.attr("id",id.replace("["+new_id+"]","["+i+"]"));
					 }
				 }
				 if(onclick_str!=null){
					 if (onclick_str.indexOf("#index#") >= 0){
						 $this.attr("onclick",onclick_str.replace(/#index#/g,i));
					 }else{
						 if(name!=null && name.indexOf("imgBtn")>=0){
							 var s = onclick_str.indexOf("[");
							 var e = onclick_str.indexOf("]");
							 var new_onclick_str = onclick_str.substring(s+1,e);
							 $this.attr("onclick",onclick_str.replace(new_onclick_str,i+"\\"+"\\"));
						 }
					 }
				 }
				 if(validtype_str!=null){
					 if(validtype_str.indexOf("#index#") >= 0){
						 $this.attr("validType",validtype_str.replace('#index#',i));
					 }
				 }
			 });
			 $(this).find('div[name=\'xh\']').html(i+1);
		 });
	 }
	 //通用弹出式文件上传
	 function commonUpload(callback,inputId){
		 $.dialog({
			 content: "url:systemController.do?commonUpload",
			 lock : true,
			 title:"文件上传",
			 zIndex:getzIndex(),
			 width:700,
			 height: 200,
			 parent:windowapi,
			 cache:false,
			 ok: function(){
				 var iframe = this.iframe.contentWindow;
				 iframe.uploadCallback(callback,inputId);
				 return true;
			 },
			 cancelVal: '关闭',
			 cancel: function(){
			 }
		 });
	 }
	 //通用弹出式文件上传-回调
	 function commonUploadDefaultCallBack(url,name,inputId){
		 $("#"+inputId+"_href").attr('href',url).html('下载');
		 $("#"+inputId).val(url);
	 }
	 function browseImages(inputId, Img) {// 图片管理器，可多个上传共用
	 }
	 function browseFiles(inputId, file) {// 文件管理器，可多个上传共用
	 }
	 function decode(value, id) {//value传入值,id接受值
		 var last = value.lastIndexOf("/");
		 var filename = value.substring(last + 1, value.length);
		 $("#" + id).text(decodeURIComponent(filename));
	 }


 </script>
